﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _07.PrintNNumbers
{
    class PrintNNumbers
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter how many numbers you would like to enter");
            string numbers = Console.ReadLine();
            int res, sum = 0 ;
            
            if(int.TryParse(numbers, out res))
            {
                for (int i = 1; i <=res; i++)
                {
                    Console.WriteLine("Enter {0} number",i);
                    int num = int.Parse(Console.ReadLine());
                    sum += num;
                }
                Console.WriteLine("The sum is {0} ",sum);
            }
              
            else 
            {
                Console.BackgroundColor = ConsoleColor.DarkRed;
                Console.WriteLine("This is not a number.Try again later!");
            }

        }
    }
}
